"""author: wenyao
   data: 2022/3/12
   project: pirate-king-2022
"""
# # join
# my_list = ["i", "love", "python"]
# print("".join(my_list))
#
# # + 效率差
# my_str = ""
# for item in my_list:
#     my_str = my_str+item
# print(my_str)
# # my_str = ""
# # my_str = "i"
# # my_str = "ilove"
# # 在每一次循环的过程中，my_str+item => 开辟内存存储


import time
my_list = ["python"]*1000000

start = time.time()
result = "".join(my_list)
cost = time.time()-start
print(cost)

start = time.time()
my_str = ""
for item in my_list:
    my_str = my_str+item
cost = time.time()-start
print(cost)